package org.kia.data.adapters.droidfu;

import com.github.droidfu.http.BetterHttp;
import org.apache.http.HttpEntity;

/**
 * Factory function for Droid-Fu Http requests
 *
 * @author Amir Lazarovich
 */
public class DroidFuRequestFactory {

    /**
     * Create a new DroidFuRequestAdapter with {@link com.github.droidfu.http.HttpGet} request
     *
     * @param uri
     * @return
     */
    public static DroidFuRequestAdapter createGetRequest(String uri) {
        return new DroidFuRequestAdapter(BetterHttp.get(uri));
    }

    /**
     * Create a new DroidFuRequestAdapter with {@link com.github.droidfu.http.HttpPost} request
     *
     * @param uri
     * @param payload
     * @return
     */
    public static DroidFuRequestAdapter createPostRequest(String uri, HttpEntity payload) {
        return new DroidFuRequestAdapter(BetterHttp.post(uri, payload));
    }

    /**
     * Create a new DroidFuRequestAdapter with {@link com.github.droidfu.http.HttpPut} request
     *
     * @param uri
     * @param payload
     * @return
     */
    public static DroidFuRequestAdapter createPutRequest(String uri, HttpEntity payload) {
        return new DroidFuRequestAdapter(BetterHttp.put(uri, payload));
    }

    /**
     * Create a new DroidFuRequestAdapter with {@link com.github.droidfu.http.HttpDelete} request
     *
     * @param uri
     * @return
     */
    public static DroidFuRequestAdapter createDeleteRequest(String uri) {
        return new DroidFuRequestAdapter(BetterHttp.delete(uri));
    }

}
